<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>ES6标准</title>
  </head>
  <body>
    <h2>let和const的使用</h2>
    <script>
      /*
        let uname;
        uname = "zhangsan";
        console.log(uname);

        let age = 10;
        console.log(age);
        */

      /*
       for (let i = 1;i < 10; i++) {
           console.log(i);
       }
       console.log(i);
       */

      //const PI = 3.1415926;
      //console.log(PI);
      //PI = 3.14;
      //错误原因：TypeError: Assignment to constant variable.
      //const PI = 3.14;
      //错误原因：SyntaxError: Identifier 'PI' has already been declared

      //定义一个人的常量对象
      const person = { name: "zhangsan", age: 20 };
      console.log(person);
      person.age = 30;
      console.log(person);
    </script>
  </body>
</html>
